import { PanelContainerState } from '@ibiz-template/runtime';
import { IControl } from '@ibiz/model-core';

/**
 * @description 分页项
 * @interface ITabItem
 */
export interface ITabItem {
  /**
   * @description 标识
   * @type {string}
   * @memberof ITabItem
   */
  id: string;
  /**
   * @description 名称
   * @type {string}
   * @memberof ITabItem
   */
  name: string;
  /**
   * @description 上下文
   * @type {IParams}
   * @memberof ITabItem
   */
  context: IContext;
  /**
   * @description 视图参数
   * @type {IParams}
   * @memberof ITabItem
   */
  params: IParams;
  /**
   * @description 部件模型
   * @type {IControl}
   * @memberof ITabItem
   */
  ctrlModel: IControl;
}

/**
 * @description 面板部件占位分页导航状态
 * @export
 * @class PanelCtrlPosTabExpState
 * @extends {PanelContainerState}
 */
export class PanelCtrlPosTabExpState extends PanelContainerState {
  /**
   * @description 当前激活分页标识
   * @type {string}
   * @memberof PanelCtrlPosTabExpState
   */
  activeTabKey?: string = '';

  /**
   * @description 分页数据
   * @type {ITabItem[]}
   * @memberof PanelCtrlPosTabExpState
   */
  tabs: ITabItem[] = [];

  /**
   * @description 缓存key
   * @type {string[]}
   * @memberof PanelCtrlPosTabExpState
   */
  cacheKeys: string[] = [];

  /**
   * @description 是否启用缓存
   * @type {boolean}
   * @memberof PanelCtrlPosTabExpState
   */
  cache: boolean = true;
}
